package pub.strawhat.album.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import pub.strawhat.album.dao.FileMapper;
import pub.strawhat.album.model.FileVO;

@Service
public class FileService {

	@Autowired
	private FileMapper fileMapper;

	public Boolean saveFile(FileVO file) {
		return fileMapper.insertFile(file);
	}

	public List<FileVO> findFileListByBatchId(Integer batchId) {
		return fileMapper.findFileListByBatchId(batchId);
	}

	public Boolean delFile(Integer batchId, Integer fileId) {
		return fileMapper.delFile(batchId, fileId);
	}

	public PageInfo<FileVO> findFileList(FileVO file, Integer pageNum, Integer pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		PageInfo<FileVO> pageInfo = new PageInfo<FileVO>(fileMapper.findFileList(file));
		return pageInfo;
	}
}
